import java.util.HashSet;

public class demo2 {
    public String removeDuplicates(String s) {
        HashSet<Character> set=new HashSet<Character>();
        StringBuilder stringBuilder=new StringBuilder();
        int temp=0;
        for(int i=0;i<s.length();i++) {
            if(!set.contains(s.charAt(i))) {
                set.add(s.charAt(i));
                stringBuilder.append(s.charAt(i));
                temp=i;
            }else {
                set.remove(s.charAt(i));
                String ret=stringBuilder.toString();
                if(ret.contains(s.charAt(i))) {
                    stringBuilder.deleteCharAt(i);
                }
            }
        }
        return stringBuilder.toString();
    }

}
